const BASE_URL = "http://localhost:7071"

export const myRequest = (options) => {
	console.log(options.url, options.method, 'myRequest')
	console.log(options, options.method)
	return new Promise((resolve, reject) => {
		uni.request({
			url: BASE_URL + options.url,
			method: options.method,
			data: options.data,
			header: {
				'Content-Type': 'application/json;charset=utf-8',
				'Access-Control-Allow-Origin': ''
			},
			success: (res) => {
				// if (res.data.code !== 200) {
				// 	return uni.showToast({
				// 		title: '获取数据失败'
				// 	})
				// }
				console.log(res)
				uni.showToast({
					title: res.data.msg
				})
				resolve(res)
			},
			fail: (err) => {
				console.log(err)
				uni.showToast({
					title: '请求接口失败'
				})
				reject(err)
			}
		})
	})
}
